<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<c:set var="contextPath" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>快递查询</title>
    <link rel="stylesheet"
          href="${contextPath}/static/common/kdniao.css">

</head>
<body>
    <section class="aui-flexView">
        <!--<header class="aui-navBar aui-navBar-fixed b-line">
            <a href="javascript:;" class="aui-navBar-item">
                <i class="icon icon-return"></i>
            </a>
            <div class="aui-center">
                <span class="aui-center-title">查看物流</span>
            </div>
            <a href="javascript:;" class="aui-navBar-item">
                <i class="icon icon-more"></i>
            </a>
        </header>-->
        <section class="aui-scrollView">
            <div class="aui-flex aui-flex-lag">
                <div class="aui-aircraft-img">
                    <img src="${contextPath}/static/image/icon-fj.png" alt="">
                </div>
                <div class="aui-flex-box">
                    <h2>
                        物流公司：<em id="company"></em>
                    </h2>
                    <h2>
                        物流单号：<em id="kdid"></em>
                    </h2>
                </div>
                <!--<div class="aui-text-copy">复制
                </div>-->
            </div>
            <div class="divHeight"></div>
            <div class="aui-flex aui-flex-lag">
                <div class="aui-flex-box">
                    <h2 style="color:#333">订单跟踪</h2>
                </div>
            </div>
            <div class="aui-timeLine b-line">
                <ul class="aui-timeLine-content" id="rootInfo">

                </ul>
            </div>
            <div class="b-line divHeight"></div>

        </section>
        <!--<footer class="aui-footer aui-footer-fixed">
            <div class="aui-artificial">
                <i class="icon icon-air"></i> 人工客服

            </div>
        </footer>-->
    </section>
    <script src="${contextPath}/static/statistics/js/jquery.js"></script>
    <script>
        var code = "${code}";
        var postNo = "${postNo}";
        $(function() {
            var kdOrder = Request["kdOrder"];
            $.ajax({
                type : "post",
                url : "${contextPath}/Honest/kdCheck",
                data: {
                    "code": "EMS",
                    "no": postNo
                },
                anyse: true,
                success: function(data) {
                    var json = strToJson(data.data);
                    console.log(json)
                    $("#company").text("EMS");
                    $("#kdid").text(json.LogisticCode);

                    if(json.Success==true){
                        kdNiaoData(json.Traces);
                    }else{
                        alert("没有物流轨迹信息");
                    }
                }
            })

            function strToJson(str){
                var json = eval('(' + str + ')');
                return json;
            }

        });



        var kdNiaoData = function(data){
            var recommend = document.getElementById("rootInfo");
            recommend.innerHTML = "";
            for(var i=data.length-1;i>=0;i--){

                var li = document.createElement('li');
                li.className = 'aui-timeLine-content-item';
                li.innerHTML ='<em class="aui-timeLine-content-icon"></em>\
							<p>'+data[i].AcceptStation+'</p>\
							<p style="margin-top: 10px;">'+data[i].AcceptTime+'</p>'
                recommend.appendChild(li);
            }

        }
    </script>
</body>
</html>
